package com.santu.edu.supporter.biz.order.pojo.po;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.santu.edu.supporter.biz.order.pojo.dto.GoodInfo;
import com.santu.edu.supporter.biz.order.pojo.dto.OrderDTO;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 
 * @TableName day_day_up_order
 */
@Data
@Accessors(chain = true)
public class OrderPO implements Serializable {
    /**
     * 
     */
    private Long id;

    /**
     * 订单id
     */
    private String orderId;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 商品集合
     */
    private String goodList;

    /**
     * 总价格
     */
    private BigDecimal price;

    /**
     * 备注信息
     */
    private String remarkInfo;

    /**
     * 送货地址id
     */
    private String addressId;

    /**
     * 送货方式
     */
    private Integer sendGoodType;

    /**
     * 送货id
     */
    private String sendGoodId;

    /**
     * 订单状态
     */
    private Integer orderStatus;

    /**
     * 支付时间
     */
    private String payTime;

    /**
     * 是否删除
     */
    private Integer isDelete;

    /**
     * 
     */
    private String gmtCreate;

    /**
     * 
     */
    private String gmtModified;

    private static final long serialVersionUID = 1L;

    public static OrderPO createItem(OrderDTO dto) {
        return new OrderPO()
                .setOrderId(dto.getOrderId())
                .setUserId(dto.getUserId())
                .setGoodList(JSON.toJSONString(dto.getGoodList()))
                .setPrice(dto.getPrice())
                .setRemarkInfo(dto.getRemarkInfo())
                .setAddressId(dto.getAddressId())
                .setSendGoodType(dto.getSendGoodType().getCode())
                .setSendGoodId(dto.getSendGoodId())
                .setOrderStatus(dto.getOrderStatus().getCode());
    }
}